const { Category } = require('../models/')
const BaseService = require('./base_service')
class CategoryService extends BaseService {
  // 获取列表
  static async getList (params = {}) {
    const res = await Category.getList(params)
    return res
  }

  // 获取列表
  static async getCateRelIds (params = {}) {
    const relations = await Category.getCateRelIds({ categoryId: params.cid })
    let ids = []
    relations.forEach(relation => {
      ids.push(relation['tag_id'])
    })
    return ids
  }

  // 获取列表
  static async getCateListTagIds (params = {}) {
    const relations = await Category.getCateListTagIds(params)
    let ids = []
    relations.forEach(relation => {
      ids.push(relation['tag_id'])
    })
    return ids
  }

}

module.exports = CategoryService
